package com.example.springboot.mapper;

import com.example.springboot.controller.dto.UserDTO;
import com.example.springboot.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface UserMapper {
    @Select("select * from sys_user")
    List<User> findall();

    @Insert("insert into sys_user(username,password,nickname,email,phone,address) values (#{username}, #{password}," +
            "#{nickname}, #{email}, #{phone}, #{address})")
    Integer insert(User user);

    int update(User user);

    @Delete("delete from sys_user where id = #{id}")
    Integer deleteById(@Param("id") Integer id);

    @Select("select * from sys_user where username=#{username} and password=#{password}")
    List<User> login(UserDTO UserDTO);

}
